<template>
	<uni-section title="项目内容" type="line">
		<uni-list>
			<view v-for="(i, index) in suggestion" :key="index" @click="goDetail(i)">
				<uni-list-item :title="i.title" :note="stateData[index]" showArrow thumb="/static/images/tabbar/work.png"
					thumb-size="base" rightText="查看详情" />
			</view>
		</uni-list>
			
	</uni-section>
</template>

<script>
	export default {
		data() {
			return {
				suggestion: [],
				stateData: [],
			}
		},
		methods: {
			goDetail(e){
				uni.navigateTo({
					url:"/pages/work/projectMydetail?id="+ e.id + "&title=" + e.title + "&state=" + e.state
				})
			},
			fabClick() {
				uni.navigateTo({
					url: '/pages/incorruptness/classSubmit'
				});
			},
			onShow() {
				var _this = this;
				uni.getStorage({
					key: 'App-Token',
					success(res) {
						_this.token = res.data;
						uni.request({
							url: 'http://xg.kystu.cn:8085/system/projectinfo_kt/list',
							method: "GET",
							header: {
								'Authorization': "Bearer " + _this.token
							},
							success: (res) => {
								if (res.data
									.code ==
									200) {
										
									// uni.showToast({
									// 	title: "查询成功",
									// 	icon: 'exception',
									// 	duration: 850
									// });
									_this.suggestion = res.data.rows;
									for (var i = 0; i < res.data.rows.length; i++) {
										if(res.data.rows[i].state == '0'){
											_this.stateData.push('申报中')
										}else if(res.data.rows[i].state == '1'){
											_this.stateData.push('通过') 
										}else if(res.data.rows[i].state == '2'){
											_this.stateData.push('未通过') 
										}
									}
								}
							}
						});
					}
				})
			}
		}
	}
</script>

<style>
.floatbtn {
 position: fixed;
    display: flex;
    flex-direction: column;
    right: 55px;
    bottom: 80px;
    z-index: 10;
    padding: 2px 2px 0 2px;
    border-radius: 3px;
/*    width: 150px; */
	}


</style>
